#ifndef CADDSECTIONDIALOG_H
#define CADDSECTIONDIALOG_H

#include <QtGui/QDialog>
#include <QtDebug>

#include "src/ciconselectionmodel.h"
#include "src/ctreeitem.h"

namespace Ui {
    class CAddSectionDialog;
}

class CAddSectionDialog : public QDialog {
    Q_OBJECT
    Q_DISABLE_COPY(CAddSectionDialog)
public:
    explicit CAddSectionDialog(QString id, QString, QWidget *parent = 0);
    virtual ~CAddSectionDialog();   

    QVariant iconName();
    QVariant icon();
    QString id();
    QString name();

    QMap<QString, QVariant> map() { return m_map; }
    QStringList blobs();

    bool isEdit() { return m_item; }

    void setItem(CTreeItem*);

protected:
    virtual void changeEvent(QEvent *e);

private:
    Ui::CAddSectionDialog *m_ui;
    CIconSelectionModel *m_model;
    QString m_parent;

    CTreeItem *m_item;
    QMap<QString, QVariant> m_map;

    void debug(QString msg) const { qDebug() << "[AddSectionDialog]\t" + msg; }

private slots:
    void checkFields();
    void process();
    void openFile();

signals:
    void cathegory(CAddSectionDialog*);
};

#endif // CADDSECTIONDIALOG_H
